<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>添加计划</title> 


    <style type="text/css">
        @import url("/pages/import/base.css");
        html, body{ margin:0; height:100%; }
    </style>
    <script type="text/javascript" src="/pages/import/base.js"></script>

    
    
<style type="text/css">
    html, body{ margin:0; height:100%;width: 100%;overflow: auto;}
</style>



<body>
   <table class="editTable" style="text-align: center;" >
          
        <tr>
            <td class="label" colspan="4" style="text-align: left;font-size: 20px;">
                <div class="divider">
                    <span style="margin-left: 50px">执行详情</span>
                </div>
            </td>
        </tr>               
        <tr>
            <td class="label">项目</td>
            <td colspan="3">
                <input id='project_id' class="easyui-combobox" data-options="required:false,width:545,editable:false">
                <input type="hidden" id="proId">
            </td>
        </tr>
        <tr>
            <td class="label">任务选择</td>
            <td colspan="3">
                 <select id="task_tree" class="easyui-combotree" style="width:545px;"></select>
                 <input type="hidden" id="planId">
                 <input type="hidden" id="taskLevel">
            </td>
        </tr>   
        <tr>
            <td class="label">任务</td>
            <td colspan="3">
                <input id='plan_name' class="easyui-textbox" data-options="required:false,width:545,editable:true,multiline:true,height:80">
            </td>
        </tr>        
         <tr>
            <td class="label">执行者</td>
            <td >
                <input id='developer' class="easyui-combobox" data-options="required:false,width:200,editable:true">
            </td>          
            </td>

            <td class="label">难度等级</td>
            <td >
                <input id='difficultyLevel' class="easyui-combobox" data-options="required:false,width:200,editable:false">
            </td>
        </tr> 
        <tr>
          <td class="label">开始日期</td>
            <td >
                <input id='startDate' class="easyui-datebox" data-options="required:false,width:200,editable:false">
            </td>
          <td class="label">截止日期</td>
            <td >
                <input id='deadline' class="easyui-datebox" data-options="required:false,width:200,editable:false">
            </td>
        </tr>                       
         
        <tr style="margin-top: 100px">
            <td>
            </td>
            <td>
            </td>
            <td>
            </td>
            <td  style="text-align: right;margin-top: 100px">
                  <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'fa fa-save',plain:true" onclick="save()" style="color:black;width:80px;height:auto;background-color: #00CD66">确定</a>
            </td>               
        </tr>          
    </table>
    
</body> 
</html>
<script type="text/javascript">

$(function(){
    $('#developer').combobox({
        url: '/system/user/getAllSelectUser.do',
        valueField: 'id',
        textField: 'name',
        panelHeight: 200,
        method: 'get',
        multiple: false,
        queryParams: {
            // 'name': 'getCompanyForList'
        },
        onLoadSuccess: function() {

        },
        onSelect: function(ret) {}
    });
    var taskVal;
    $('#project_id').combobox({
        url: '/develop/url/getUrl.do',
        valueField: 'id',
        textField: 'project_name',
        panelHeight: 200,
        method: 'get',
        multiple: false,
        queryParams: {
            'name': 'getProjectListForCombobox'
        },
        onLoadSuccess: function() {

        },
        onSelect: function(ret) {
        	$('#task_tree').combotree({
        	    url:'/pm2/plan/getTaskPlanTree.do',
        	    queryParams: {
                    'projectId': ret.id
                },
                multiple:false, 
        	    onClick: function(node){  // alert node text property when clicked
        	    	$("#plan_name").textbox('setValue',node.text);
        	    	$("#planId").val(node.id);
        	    	$("#taskLevel").val(node.level);
        			
        		}
          });
        }
    });  
    
    $('#difficultyLevel').combobox({
        url: '/develop/url/getUrl.do',
        valueField: 'id',
        textField: 'text',
        panelHeight: 200,
        method: 'get',
        multiple: false,
        queryParams: {
            'name': 'getCoefficientList'
        },
        onLoadSuccess: function() {

        },
        onSelect: function(ret) {}
    }); 
    //加载树形菜单数据
    
});

function save()
{
    parent.$('#dg3').datagrid('appendRow',{
        id: 0,
        project_id: $('#project_id').combobox('getValue'),
        project_text: $('#project_id').combobox('getText'),
        plan_name: $('#plan_name').textbox('getValue'),
        developer: $('#developer').combobox('getValue'),
        developer_text: $('#developer').combobox('getText'),
        difficulty_level:$('#difficultyLevel').combobox('getText'),
        start_date:$('#startDate').datebox('getValue'),
        deadline: $('#deadline').datebox('getValue'),
        plan_id:$("#planId").val(),
        task_level:$("#taskLevel").val()
    });
    parent.$('#dg3').datagrid('autoSizeColumn');
    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
    parent.layer.close(index); //再执行关闭
}


</script>